-
Notifications
You must be signed in to change notification settings - Fork 0
Add describe tool #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new ddev_describe tool to provide structured access to DDEV project information, refactors DDEV data fetching logic into a dedicated module, and updates dependencies. The changes improve code organization by separating concerns and make DDEV project information more accessible to LLMs through a dedicated tool.
- Added a new
describe.tsmodule that encapsulates DDEV project information fetching, parsing, and tool creation - Refactored
index.tsto use the newgetDdevDescribeDatafunction, reducing code duplication - Updated session notification messages to reference the new
ddev_describetool and clarify environment variable locations
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| describe.ts | New module defining types, data fetching functions, and the ddev_describe tool for accessing DDEV project information (domain, ports, status, etc.) |
| index.ts | Refactored to use the new getDdevDescribeData function, integrated the ddev_describe tool, added 'curl' to HOST_ONLY_COMMANDS, and improved session notification messages |
| package.json | Updated dependency versions: @opencode-ai/plugin to ^1.0.188, @opencode-ai/sdk to ^1.0.188, and @types/node to ^25.0.3 |
| package-lock.json | Updated lockfile entries to match the new dependency versions in package.json |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for (const field of requestedFields) { | ||
| if (field in info) { | ||
| const value = info[field as keyof DdevProjectInfo]; | ||
| result[field as keyof DdevProjectInfo] = value as any; | ||
| } |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field filtering logic doesn't validate if requested fields are valid. If a user passes an invalid field name that doesn't exist in DdevProjectInfo (e.g., a typo), it will silently be ignored. Consider adding validation to warn users about invalid field names or throw an error listing valid options.
| const raw = await getDdevDescribeData($); | ||
|
|
||
| if (!raw) { | ||
| throw new Error('Failed to get DDEV project data. Make sure DDEV is running.'); |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message states "Make sure DDEV is running" but DDEV might be stopped, not installed, or the project might not be configured. Consider making the error message more accurate, such as "Failed to get DDEV project data. Ensure DDEV is installed, a project is configured, and DDEV is running."
| throw new Error('Failed to get DDEV project data. Make sure DDEV is running.'); | |
| throw new Error('Failed to get DDEV project data. Ensure DDEV is installed, a project is configured, and DDEV is running.'); |
| /** | ||
| * Notifies LLM about DDEV environment on first command execution | ||
| * | ||
| * @link https://docs.ddev.com/en/stable/users/extend/customization-extendibility/#environment-variables-for-containers-and-services |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trailing space in the @link tag could cause documentation rendering issues. Remove the trailing space after the URL.
| * @link https://docs.ddev.com/en/stable/users/extend/customization-extendibility/#environment-variables-for-containers-and-services | |
| * @link https://docs.ddev.com/en/stable/users/extend/customization-extendibility/#environment-variables-for-containers-and-services |
| /** | ||
| * Raw DDEV project data from `ddev describe -j` | ||
| */ | ||
| type DdevRawData = { | ||
| shortroot?: string; | ||
| approot?: string; | ||
| status?: string; | ||
| name?: string; | ||
| [key: string]: unknown; | ||
| }; | ||
| type DdevRawData = DdevDescribeRaw; |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type alias DdevRawData is redundant. Since it's just aliasing DdevDescribeRaw without adding any additional semantics, consider removing it and using DdevDescribeRaw directly throughout the code. This reduces indirection and makes the code easier to follow.
This pull request introduces a new tool for accessing DDEV project information and refactors how DDEV environment data is handled in the plugin. The main focus is on modularizing the logic for fetching and parsing DDEV project details, exposing a new
ddev_describetool, and improving session notifications. It also updates dependencies to newer versions.DDEV project info extraction and tool integration:
describe.tsmodule that defines types for DDEV describe output, provides functions to fetch and extract simplified project info, and exposes acreateDdevDescribeToolfor use in the plugin.ddev_describetool into the plugin, making it available alongside the existingddev_logstool.Refactoring and code cleanup:
index.tsto use the newgetDdevDescribeDatafunction fromdescribe.ts, removing redundant parsing logic and type definitions. [1] [2] [3]ddev_describetool and clarify environment variable locations.Dependency updates:
@opencode-ai/plugin,@opencode-ai/sdk, and@types/nodeto newer versions inpackage.jsonfor compatibility and improvements.